home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / n_b_v203.zip / STR-MATH.DMO < prev    next >
Text File  |  1996-07-04  |  3KB  |  67 lines

  1. $if 0
  2.     ┌──────────────────────────╖                        PowerBASIC v3.20
  3.  ┌──┤          DASoft          ╟──────────────────────┬──────────────────╖
  4.  │  ├──────────────────────────╢    Copyright 1995    │ DATE: 1996-02-08 ╟─╖
  5.  │  │ FILE NAME   STR-MATH.DMO ║          by          ╘════════════════─ ║ ║
  6.  │  │                          ║  Don Schullian, Jr.                     ║ ║
  7.  │  ╘══════════════════════════╝                                         ║ ║
  8.  │ A license is hereby granted to the holder to use this source code in  ║ ║
  9.  │ any program, commercial or otherwise,  without receiving the express  ║ ║
  10.  │ permission of the copyright holder and without paying any royalties,  ║ ║
  11.  │ as long as this code is not distributed in any compilable format.     ║ ║
  12.  │  IE: source code files, PowerBASIC Unit files, and printed listings   ║ ║
  13.  ╘═╤═════════════════════════════════════════════════════════════════════╝ ║
  14.    │                ....................................                   ║
  15.    ╘═══════════════════════════════════════════════════════════════════════╝
  16. $endif
  17.  
  18. '.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
  19. ' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
  20.  
  21. $STRING 32
  22. $INCLUDE "DAS-NB03.INC"
  23. COLOR 7, 0
  24. CLS
  25.  
  26. ? "┌───────────────────────────────────────────────────────────────────────
  27. ? "│ fADDnbr$( N1$, N2$ )         ' equiv: N1$ + N2$
  28. ? "│ fSUBnbr$( N1$, N2$ )         ' equiv: N1$ - N2$
  29. ? "│ fMULnbr$( N1$, N2$ )         ' equiv: N1$ * N2$
  30. ? "│ fDIVnbr$( N1$, N2$, Decs% )  ' equiv: N1$ / N2$ to Decs% places
  31. ? "├───────────────────────────────────────────────────────────────────────
  32. ? "│ These 4 functions provide mathematical services for extremely large,
  33. ? "│ small, or precise unreal numbers. You can have over 32,000 digits.
  34. ? "└───────────────────────────────────────────────────────────────────────
  35.  
  36. N1$ = "0.7827"  :  N1# = VAL( N1$ )
  37. N2$ = "234.9"   :  N2# = VAL( N2$ )
  38.  
  39. PRINT "N1$ =   "; N1$
  40. PRINT "N2$ = "; N2$
  41. PRINT STRING$( 79, "─" )
  42.  
  43. PRINT "ADD..... DASoft = ";
  44.   PRINT fADDnbr$( N1$, N2$ )
  45.   N# = N1# + N2#
  46.   GOSUB PRINT_IT
  47. PRINT "SUB..... DASoft = ";
  48.   PRINT fSUBnbr$( N1$, N2$ )
  49.   N# = N1# - N2#
  50.   GOSUB PRINT_IT
  51. PRINT "MUL..... DASoft = ";
  52.   PRINT fMULnbr$( N1$, N2$ )
  53.   N# = N1# * N2#
  54.   GOSUB PRINT_IT
  55. PRINT "DIV..... DASoft = ";
  56.   PRINT fDIVnbr$( N1$, N2$, 55 )
  57.   N# = N1# / N2#
  58.   GOSUB PRINT_IT
  59. END
  60.  
  61. '─────────────────────────────────────────────────────────────────
  62. PRINT_IT:
  63.   PRINT "         PBasic = ";
  64.   PRINT LTRIM$( USING$( "+###.################", N# ) )
  65.   PRINT "========================"
  66. RETURN
  67.